//
//  Kingfisher+Extension.swift
//  SmartEyeForPatient
//
//  Created by QDSG on 2021/4/22.
//

import Foundation
import UIKit
import Kingfisher

extension KingfisherWrapper where Base: KFCrossPlatformImageView {
    @discardableResult
    func setAvatarImage(urlString: String?, placeholder: Placeholder? = Asset.profileAvatorImage.image) -> DownloadTask? {
        return setImage(with: URL(string: urlString ?? ""),
                        placeholder: placeholder,
                        options: [.transition(.fade(0.5))])
    }
    
    @discardableResult
    func setImage(urlString: String?, placeholder: Placeholder? = Asset.iconImageviewPlaceholder.image) -> DownloadTask? {
        return setImage(with: URL(string: urlString ?? ""),
                        placeholder: placeholder,
                        options: [.transition(.fade(0.5))])
    }
}
